package se.webbzon.oschi01.nbt;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;

import se.webbzon.oschi01.singleton.Singleton;

public class DoubleTagFactory extends AbstractTagFactory<Double> implements Singleton {

	private DoubleTagFactory() {
		super(Tags.TAG_DOUBLE, "TAG_Double");
	}

	@Override public DoubleTag readTag(String tagName, DataInputStream is) throws IOException {
		return new DoubleTag(this, tagName,is.readDouble());
	}

	@Override public void writeTag(Tag<Double> tag, DataOutputStream dos) throws IOException {
		dos.writeDouble(tag.getValue());
	}

	@Override public Tag<Double> createTag(String tagName) {
		return new DoubleTag(this, tagName, 0);
	}

}
